package uml.behavioral.interpreter;

import uml.behavioral.interpreter.exception.IllegalInstructionException;

/**
 * 解释器--终结符表达式<br>
 * on 2022/12/31 0:23
 */
public class ActionNode extends AbstractNode {
    private String action;

    public ActionNode(String action) {
        this.action = action;
    }

    @Override
    public String interpret() throws IllegalInstructionException {
        switch (this.action) {
            case "move":
                return "移动";
            case "run":
                return "跑";
            case "walk":
                return "走";
            case "roll":
                return "滚动";
            case "jump":
                return "跳";
            case "slip":
                return "滑动";
            case "climb":return "攀爬";
            default:
                throw new IllegalInstructionException("无效指令"+this.action);
        }
    }
}
